package com.bdqn.util;

import java.util.List;

public class Page<T> {

	private  Integer  pageIndex;
	private  Integer  count;
	private  Integer  totalPage;
	private  Integer  pageSize;
	private  List<T>  dataList;
	
	
	public Page(){}
	public Page(Integer pageIndex, Integer count, Integer pageSize, List<T> dataList) {
		super();
		this.pageIndex = pageIndex;
		this.count = count;
		this.pageSize = pageSize;
		this.dataList = dataList;
	}
	public Page(Integer pageIndex, Integer count, Integer totalPage, Integer pageSize, List<T> dataList) {
		super();
		this.pageIndex = pageIndex;
		this.count = count;
		this.totalPage = totalPage;
		this.pageSize = pageSize;
		this.dataList = dataList;
	}
	public Integer getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}
	public Integer getCount() {
		return count;
	}
	public void setCount(Integer count) {
		this.count = count;
	}
	public Integer getTotalPage() {
		if(count>0&&pageSize>0){
			return   count%pageSize==0?count/pageSize:count/pageSize+1;
		}
		return totalPage;
	}
	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	public Integer getPageSize() {
		return pageSize;
	}
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}
	public List<T> getDataList() {
		return dataList;
	}
	public void setDataList(List<T> dataList) {
		this.dataList = dataList;
	}
}
